package com.nulldev.util.java.swing.fastEPane;

import java.awt.Image;
import java.lang.management.GarbageCollectorMXBean;
import java.net.URL;
import java.util.HashMap;

public class GlobalImageCache {

	/**
	 * <Image.URL(), Image> 
	 */
	private static final HashMap<URL, Image> cache = new HashMap<URL, Image>();
	
	public static HashMap<URL, Image> cloneList() {
		return (HashMap<URL, Image>) cache.clone();
	}
	
	public static Image getImage(final URL url) {
		return cache.get(url);
	}

	public static Image register(final URL src, final Image image) {
		return cache.put(src, image);
	}
	
	public static int cachedImages() {
		return cache.size();
	}
}
